﻿
<!--
https://github.com/netnr
https://gitee.com/netnr
https://www.netnr.com
https://zme.ink
-->


<!DOCTYPE html>
<html>
<head>

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' />


    <title>壁纸 脚本服务</title>

    <meta name="keywords" content="netnr NET牛人 壁纸" />
    <meta name="description" content="Script Services 360高清壁纸" />

</head>
<body>
<div id='LoadingMask' style='position:fixed;top:0;left:0;bottom:0;right:0;background-color:white;z-index:19999;background-image:url('/images/loading.svg');background-repeat:no-repeat;background-position:48% 45%'></div>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css' rel='stylesheet'>
<script src='https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/jzjs@2.0.2/2.0.2/jz.min.js'></script>
<link href='https://cdn.jsdelivr.net/npm/netnrnav@1.1.0/src/netnrnav.css' rel='stylesheet' />
<script src='https://cdn.jsdelivr.net/npm/netnrnav@1.1.0/src/netnrnav.js' defer async></script>

<script>
    $.ajax({
        url: '/images/icon.svg?20201228',
        dataType: 'text',
        success: function (data) {
            $('body').append('<div class="d-none">' + data + '</div>')
        }
    })
</script>

        <link href="/css/global.css?v=YuzFOH_Z7ma5bs-3HMdZQu0aPQZ1pkBqrzQ_Ri8Yh3k" rel="stylesheet" />
        <script src="/js/global.js?v=ckkNo3hER74SKnNCuouMgEfxEpEMP3phtPl9uA0_Lnc"></script>
        <div class="min300 mt-3">
            <style>
    body {
        overflow-y: scroll;
        background-color: #ededed;
    }

    /*导航*/
    .dnav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 2;
        width: 100%;
        opacity: .4;
        height: 35px;
        background-color: #fff;
        filter: alpha(opacity=40);
        border-bottom: 1px solid #ededed;
    }

        .dnav a.ahome img {
            height: 30px;
            margin-top: 3px;
            margin-left: 15%;
        }

        .dnav a, .dnav a:hover, .dnav a:active, .dnav a:focus {
            outline: none;
            box-shadow: none;
            text-align: center;
            border-color: transparent;
            background-color: transparent;
        }

        .dnav:hover {
            opacity: .9;
            filter: alpha(opacity=90);
        }

        .dnav .btn-group {
            margin-right: 15%;
        }

        .dnav .dropdown-menu {
            min-width: 110px;
        }

    .divWP {
        margin-top: 30px;
    }

        .divWP div.row {
            margin-left: -10px;
            margin-right: -10px;
        }

        .divWP div {
            margin: 0;
            padding: 0;
        }

            .divWP div img {
                width: 100%;
                height: 100%;
                cursor: url(https://img.t.sinajs.cn/t6/style/images/common/big.cur), default;
            }

            .divWP div.pu {
                padding: 5px;
            }

                .divWP div.pu .list-group {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 150px;
                    display: none;
                    opacity: .8;
                    filter: alpha(opacity=80);
                }

                    .divWP div.pu .list-group a {
                        color: #777;
                        padding: 2px 3px;
                        border-radius: 0;
                    }

                .divWP div.pu:hover .list-group {
                    display: block;
                }


    /*全屏查看*/
    .divFP {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 3333;
        background-color: #ededed;
    }

        .divFP a {
            position: fixed;
            top: 0;
            color: red;
            z-index: 2;
            right: 15px;
            font-size: 3rem;
            cursor: pointer;
            text-decoration: none;
        }

        .divFP img {
            position: absolute;
            z-index: 1;
            cursor: move;
        }
</style>

<div class="dnav">
    <a href="/" class="ahome">
        <img src="/favicon.svg" />
    </a>
    <div class="btn-group float-right">
        <label class="btn btn-light btn-sm m-0" title="如果无法显示图片，可以尝试勾选代理线路">
            <input type="checkbox" value="1" class="nrUseProxy" /> 代理线路
        </label>
        <button class="btn btn-light btn-sm dropdown-toggle" id="ddType" data-toggle="dropdown">
            壁纸分类
        </button>
        <div class="dropdown-menu dropdown-menu-right" id="dmType" style="max-height:400px;overflow-y:scroll">
            <a class="dropdown-item" href="#">最新壁纸</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#36">4K专区</a>
            <a class="dropdown-item" href="#6">美女模特</a>
            <a class="dropdown-item" href="#30">爱情美图</a>
            <a class="dropdown-item" href="#9">风景大片</a>
            <a class="dropdown-item" href="#15">小清新</a>
            <a class="dropdown-item" href="#26">动漫卡通</a>
            <a class="dropdown-item" href="#11">明星风尚</a>
            <a class="dropdown-item" href="#14">萌宠动物</a>
            <a class="dropdown-item" href="#5">游戏壁纸</a>
            <a class="dropdown-item" href="#12">汽车天下</a>
            <a class="dropdown-item" href="#10">炫酷时尚</a>
            <a class="dropdown-item" href="#29">月历壁纸</a>
            <a class="dropdown-item" href="#7">影视剧照</a>
            <a class="dropdown-item" href="#13">节日美图</a>
            <a class="dropdown-item" href="#22">军事天地</a>
            <a class="dropdown-item" href="#16">劲爆体育</a>
            <a class="dropdown-item" href="#18">BABY秀</a>
            <a class="dropdown-item" href="#35">文字控</a>
        </div>
    </div>
</div>

<div class="container-fluid divWP" id="divWP"></div>

<script>
    var config = {
        cid: '',
        start: 1,
        count: 12,
        total: 0,
        isload: false,
        isend: false
    }, rt = {
        //随机一种布局模式
        LayoutMode: function () {
            var gn = [12],
                gi = Math.ceil(Math.random() * gn.length) - 1,
                pn = gn[gi];
            return pn;
        },
        //载入
        LoadList: function (count) {
            if (config.isload || config.isend) {
                return false;
            }

            count = count || rt.LayoutMode();
            config.count = count;
            config.isload = true;

            var uri = 'http://wallpaper.apc.360.cn/index.php?c=WallPaper&start=' + config.start + '&count=' + config.count + '&from=360chrome';
            if (config.cid && config.cid != '') {
                uri += '&a=getAppsByCategory&cid=' + config.cid;
            } else {
                uri += '&a=getAppsByOrder&order=create_time';
            }

            ss.ajax({
                url: uri,
                dataType: 'json',
                success: function (data) {
                    data = ss.datalocation(data);
                    if (!data.data.length) {
                        config.isend = true;
                        rt.ThEnd();
                        return false;
                    }
                    config.total = parseInt(data.total);
                    config.start += config.count;
                    config.isload = false;
                    rt.RenderView(data);
                },
                error: function (ex) {
                    config.isload = false;
                    console.log(ex);
                },
                complete: function () {
                    ss.loading(0);
                }
            });
        },
        //下载
        DownView: function (item) {
            var size = ["img_1600_900", "img_1440_900", "img_1366_768", "img_1280_800", "img_1280_1024", "img_1024_768"], htm = [];
            htm.push("<div class='list-group'>");
            htm.push("<a href='" + rt.urlProxy(item.url.replace("__85", "__100")) + "' target='_blank' class='list-group-item' download>▼原图(" + item.resolution + ")</a>");
            $(size).each(function () {
                var url = item[this], txt = this.replace('img_', '').replace('_', 'x');
                if (url) {
                    htm.push("<a href='" + rt.urlProxy(url) + "' class='list-group-item' target='_blank' download>▼" + txt + "</a>");
                }
            });
            htm.push('</div>');
            return htm.join('');
        },
        //拼接图片
        JoinImg: function (item, cuturl) {
            var tit = item.utag;
            if (!tit) {
                var tags = item.tag.split(' ');
                tit = tags.slice(1, tags.length - 1).join(' ').replace(/_/g, "").replace(/category/g, "");
            }
            return "<img data-url='" + rt.urlProxy(item.url) + "' title='" + tit + "' src='" + cuturl + "' />"
        },
        //拼接容器
        JoinBox: function (content, pu) {
            return "<div class='col-sm-12 col-md-6 " + (pu ? "pu" : "") + " '>" + content + "</div>";
        },
        //呈现
        RenderView: function (json) {
            if (json.errno == "0") {
                var max_wh = "1000_618", htm = [], datas = json.data, len = config.count, i = 0;
                switch (len) {
                    case 12:
                        {
                            var col = 2;
                            for (var r = 1; r < len / col + 1; r++) {
                                htm.push("<div class='row'>");
                                for (; i < r * len / (len / col);) {
                                    var item = datas[i++], url = rt.urlProxy(item.url);
                                    var cuturl = url.replace("/bdr/__85", "/bdm/" + max_wh + "_80");
                                    var inbox = ["<div class='col-sm-12 col-md-6 pu'>"];
                                    inbox.push(rt.JoinImg(item, cuturl));
                                    inbox.push(rt.DownView(item));
                                    inbox.push("</div>");
                                    htm.push(inbox.join(''));
                                }
                                htm.push("</div>");
                            }
                        }
                        break;
                }
                $('#divWP').append($(htm.join('')));
            } else {
                console.log(json.errmsg);
            }
        },
        //清空
        ClearPage: function () {
            config.cid = '';
            config.start = 1;
            config.isend = false;
            config.isload = false;
            $('#divWP').html('');
        },
        //完
        ThEnd: function () {
            $('#divWP').append($('<div class="row"><div class="col-sm-12 h4 text-center text-muted py-3">没有啦 ...</div></div>'));
        },
        //全屏
        FullShow: function (src) {
            document.documentElement.style.overflowY = "hidden";
            $('<div class="divFP"><a href="javascript:rt.FullClose()">✖</a><img src="' + src + '" title="拖动图片" /></div>').appendTo(document.body);
        },
        //关闭全屏
        FullClose: function () {
            document.documentElement.style.overflowY = "scroll";
            $(document.body).children('div.divFP').remove();
        },
        //代理
        urlProxy: function (url) {
            if (ss.lsStr("useProxy") == "1") {
                url = "https://netnr-proxy.openode.io/" + url.replace("http://", "");
            } else {
                url = url.replace("http://", "https://");
            }
            return url;
        }
    };

    //点击代理
    $('.nrUseProxy').click(function () {
        ss.ls["useProxy"] = this.checked ? 1 : 0;
        ss.lsSave();
        location.reload(false);
    })[0].checked = ss.lsStr("useProxy") == "1";

    //点击分类
    $('#dmType').click(function (e) {
        e = e || window.event;
        var target = e.target || e.srcElement;
        if (target.nodeName == "A") {
            rt.ClearPage();
            config.cid = target.hash.substring(1);
            rt.LoadList();
            document.title = target.innerHTML + " 在线壁纸 NET牛人";
            ss.loading();
        }
    });

    //点击列表
    $('#divWP').click(function (e) {
        e = e || window.event;
        var target = e.target || e.srcElement;
        if (target.nodeName == "IMG") {
            rt.FullShow(target.getAttribute('data-url'));
        }
    });

    //初始化载入最新
    $(window).on('load', function () {
        var dtype = location.hash;
        $('#dmType').find('a').each(function () {
            if (this.hash == dtype) {
                config.cid = dtype.substring(1);
                document.title = this.innerHTML + " 在线壁纸 NET牛人";
                return false;
            }
        });
        ss.loading();
        rt.LoadList();
    }).on('scroll mousewheel DOMMouseScroll', function () {
        var sb = $(document).height() - $(this).height() - $(this).scrollTop();
        if (sb < 1200) {
            rt.LoadList();
        }
    }).mousedown(function (e) {
        e = e || window.event;
        var target = e.target || e.srcElement;
        if (target.nodeName == "IMG" && target.parentNode.className.indexOf("divFP") >= 0) {
            var sX = e.clientX - target.offsetLeft,
                sY = e.clientY - target.offsetTop;

            window._drag = 1;
            document.ondragstart = function () { return false; }
            $(window).on('mousemove', function (e) {
                if (e && e.preventDefault) {
                    e.preventDefault()
                } else {
                    window.event.returnValue = false
                }

                var _self = arguments.callee;
                if (!window._drag) {
                    $(window).off('mousemove', _self);
                }

                e = e || window.event;
                var eX = e.clientX, eY = e.clientY;
                var x = eX - sX, y = eY - sY;

                $(target).css('top', y).css('left', x);
                $(window).on('mouseup', function () {
                    this.releaseCapture && this.releaseCapture()
                    $(window).off('mouseup', arguments.callee).off('mousemove', _self);
                });

                this.setCapture && this.setCapture();
                return false;
            });
        }
    }).mouseup(function () {
        window._drag = 0;
    });
</script>
        </div>
        <a href="javascript:ss.toTop();" class="totop" title="返回顶部">ˆ</a>
</body>
</html>
